using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;
using SalesPages.DomainModel;
namespace SalesPages.EntityFrameworkRepository.Mapping
{
    public class EventNewMap : EntityTypeConfiguration<EventNew>
    {
        public EventNewMap()
        {
            // Primary Key
            this.HasKey(t => t.EventNews_id);

            // Properties
            this.Property(t => t.Country)
                .IsRequired()
                .HasMaxLength(5);

            this.Property(t => t.Title)
                .IsRequired()
                .HasMaxLength(250);

            this.Property(t => t.Description)
                .IsRequired()
                .HasMaxLength(2500);

            this.Property(t => t.Location)
                .IsRequired()
                .HasMaxLength(100);

            this.Property(t => t.EventStart)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.EventEnd)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.ImageList)
                .IsRequired()
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("EventNews");
            this.Property(t => t.EventNews_id).HasColumnName("EventNews_id");
            this.Property(t => t.Country).HasColumnName("Country");
            this.Property(t => t.Title).HasColumnName("Title");
            this.Property(t => t.Description).HasColumnName("Description");
            this.Property(t => t.Location).HasColumnName("Location");
            this.Property(t => t.EventStart).HasColumnName("EventStart");
            this.Property(t => t.EventEnd).HasColumnName("EventEnd");
            this.Property(t => t.ImageList).HasColumnName("ImageList");
            this.Property(t => t.PublishDate).HasColumnName("PublishDate");
            this.Property(t => t.EventDate).HasColumnName("EventDate");
            this.Property(t => t.InsertDate).HasColumnName("InsertDate");
            this.Property(t => t.UpdateDate).HasColumnName("UpdateDate");
        }
    }
}
